# ===============================================================
# Filename: Makefile
# -------------------------------
# Copyright(C),
# Author: zhenquan.qiu
# Version: V1.0.0
# Last modified: 01/03 2017 10:16
# Description:
#
# Change Log:
# NO.	Author		    Date		Modified
# 00	zhenquan.qiu	01/03 2017
# ===============================================================

ifneq ($(KERNELRELEASE),)
    obj-m := busDemo.o drvDemo.o devDemo.o
else
	KDIR := /lib/modules/`uname -r`/build/
#	KDIR := /opt/aispeech/x1000-src/kernel-3.0.8-doss/
#	KDIR := /opt/qz/r16/tina/src/lichee/linux-3.4/

	APP_TARGET := busDemoTest
	PWD ?= $(shell pwd)

modules:
	$(MAKE) -C $(KDIR) M=$(PWD) modules

modules_install:
	$(MAKE) -C $(KDIR) M=$(PWD) modules_install

app:
	$(CC) $(APP_TARGET).c -o $(APP_TARGET)

#################################################
index-update:
	ctags -R
	cscope -Rbkq

clean:
	rm -rf *.mod.c *.o *.ko *.bak modules.* Module.*
	rm -rf .*.cmd .tmp_versions
	rm -rf $(APP_TARGET)

distclean: clean
	rm -rf *.out tags

.PHONY:
	modules modules_install clean distclean
endif

